<?php
require_once("inc.member.php");

$this_title="$vars[member_title] &raquo; ".__("Auto Matrix");
$page_title=__("Auto Matrix");
$content_title=__("Auto Matrix");

//tab
$css="<link rel='stylesheet' type='text/css' href='".CSS_URL."/tab/tab".(USER_BROWSER=='msie'? "-ie" : "").".css' />\n";
if($r_user['rank_a']=='1.0'){
$tab=
"<ul class='tabs-nav' id='_tab'>
  <li class='tabs-".($_GET['action']=='first' || !$_GET['action']? "" : "un")."selected' rel='first'><a href='".$vars['file']['member']['auto_matrix']."?action=first'><span>".__("3 Stars").__("Matrix Entry Level")."</span></a></li>
  <li class='tabs-".($_GET['action']=='second'? "" : "un")."selected' rel='second'><a href='".$vars['file']['member']['auto_matrix']."?action=second'><span>".__("3 Stars").__("Matrix Medium Level")."</span></a></li>
  <li class='tabs-".($_GET['action']=='third'? "" : "un")."selected' rel='third'><a href='".$vars['file']['member']['auto_matrix']."?action=third'><span>".__("3 Stars").__("Matrix High Level")."</span></a></li>
</ul>
<div class='tabs-panel' style='width:97%;'><%tab_content%></div>";
}else{
$tab=
"<ul class='tabs-nav' id='_tab'>
  <li class='tabs-".($_GET['action']=='fourth' || !$_GET['action']? "" : "un")."selected' rel='fourth'><a href='".$vars['file']['member']['auto_matrix']."?action=fourth'><span>".__("5 Stars").__("Matrix Entry Level")."</span></a></li>
  <li class='tabs-".($_GET['action']=='fifth'? "" : "un")."selected' rel='fifth'><a href='".$vars['file']['member']['auto_matrix']."?action=fifth'><span>".__("5 Stars").__("Matrix Medium Level")."</span></a></li>
  <li class='tabs-".($_GET['action']=='sixth'? "" : "un")."selected' rel='sixth'><a href='".$vars['file']['member']['auto_matrix']."?action=sixth'><span>".__("5 Stars").__("Matrix High Level")."</span></a></li>
</ul>
<div class='tabs-panel' style='width:97%;'><%tab_content%></div>";	
}

if($_GET['action']=="first"){
 
   	$sql="SELECT * FROM $db->matrix_first WHERE uid=".$uid;

}elseif($_GET['action']=="second"){
	
	$sql="SELECT * FROM $db->matrix_second WHERE uid=".$uid;
   
}elseif($_GET['action']=="third"){
	
	$sql="SELECT * FROM $db->matrix_third WHERE uid=".$uid;
   
}elseif($_GET['action']=="fourth" || !$_GET['action']){
	
	$sql="SELECT * FROM $db->matrix_fourth WHERE uid=".$uid;
   
}elseif($_GET['action']=="fifth"){
	
	$sql="SELECT * FROM $db->matrix_fifth WHERE uid=".$uid;
   
}elseif($_GET['action']=="sixth"){
	
	$sql="SELECT * FROM $db->matrix_sixth WHERE uid=".$uid;
  
}

if(@mysql_num_rows($r=mysql_query($sql))){
	$matrix=mysql_fetch_assoc($r);
}else{
	$matrix['lvl_1'] = 0;
	$matrix['lvl1_1'] = 0;
	$matrix['lvl1_2'] = 0;
	$matrix['lvl1_3'] = 0;
	$matrix['lvl2_1'] = 0;
	$matrix['lvl2_2'] = 0;
	$matrix['lvl2_3'] = 0;
	$matrix['lvl2_4'] = 0;
	$matrix['lvl2_5'] = 0;
	$matrix['lvl2_6'] = 0;
	$matrix['lvl2_7'] = 0;
	$matrix['lvl2_8'] = 0;
	$matrix['lvl2_9'] = 0;
}

if($matrix['lvl_1']>0){
	$r1=get_user_detail_by_id($matrix['lvl_1']);
	$matrix['lvl_1']=$r1['code'];
}
if($matrix['lvl1_1']>0){
	$r1=get_user_detail_by_id($matrix['lvl1_1']);
	$matrix['lvl1_1']=$r1['code'];
}
if($matrix['lvl1_2']>0){
	$r1=get_user_detail_by_id($matrix['lvl1_2']);
	$matrix['lvl1_2']=$r1['code'];
}
if($matrix['lvl1_3']>0){
	$r1=get_user_detail_by_id($matrix['lvl1_3']);
	$matrix['lvl1_3']=$r1['code'];
}
if($matrix['lvl2_1']>0){
	$r1=get_user_detail_by_id($matrix['lvl2_1']);
	$matrix['lvl2_1']=$r1['code'];
}
if($matrix['lvl2_2']>0){
	$r1=get_user_detail_by_id($matrix['lvl2_2']);
	$matrix['lvl2_2']=$r1['code'];
}
if($matrix['lvl2_3']>0){
	$r1=get_user_detail_by_id($matrix['lvl2_3']);
	$matrix['lvl2_3']=$r1['code'];
}
if($matrix['lvl2_4']>0){
	$r1=get_user_detail_by_id($matrix['lvl2_4']);
	$matrix['lvl2_4']=$r1['code'];
}
if($matrix['lvl2_5']>0){
	$r1=get_user_detail_by_id($matrix['lvl2_5']);
	$matrix['lvl2_5']=$r1['code'];
}
if($matrix['lvl2_6']>0){
	$r1=get_user_detail_by_id($matrix['lvl2_6']);
	$matrix['lvl2_6']=$r1['code'];
}
if($matrix['lvl2_7']>0){
	$r1=get_user_detail_by_id($matrix['lvl2_7']);
	$matrix['lvl2_7']=$r1['code'];
}
if($matrix['lvl2_8']>0){
	$r1=get_user_detail_by_id($matrix['lvl2_8']);
	$matrix['lvl2_8']=$r1['code'];
}
if($matrix['lvl2_9']>0){
	$r1=get_user_detail_by_id($matrix['lvl2_9']);
	$matrix['lvl2_9']=$r1['code'];
}

$messaging = '		
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="5.5%">&nbsp;</td>
<td width="1%">&nbsp;</td>
</tr>
<tr>
<td colspan="18" align="center"><img src="../image/rgicon'.($matrix['lvl_1']=='0'?"0":"").'.png"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="18" align="center">'.($matrix['lvl_1']=='0'?__('Available'):$matrix['lvl_1'].'<br>'.$matrix['date_1']).'</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
<td colspan="6" style="border-right:1mm solid #2284C6; border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="6" style="border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="3">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
<td colspan="6" style="border-right:1mm solid #2284C6; border-left:1mm solid #2284C6">&nbsp;</td>
<td colspan="6" style="border-right:1mm solid #2284C6">&nbsp;</td>
<td colspan="3">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="6" align="center"><img src="../image/rgicon'.($matrix['lvl1_1']=='0'?"0":"").'.png"></td>
<td colspan="6" align="center"><img src="../image/rgicon'.($matrix['lvl1_2']=='0'?"0":"").'.png"></td>
<td colspan="6" align="center"><img src="../image/rgicon'.($matrix['lvl1_3']=='0'?"0":"").'.png"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="6" align="center">'.($matrix['lvl1_1']=='0'?__('Available'):$matrix['lvl1_1'].'<br>'.$matrix['date1_1']).'</td>
<td colspan="6" align="center">'.($matrix['lvl1_2']=='0'?__('Available'):$matrix['lvl1_2'].'<br>'.$matrix['date1_2']).'</td>
<td colspan="6" align="center">'.($matrix['lvl1_3']=='0'?__('Available'):$matrix['lvl1_3'].'<br>'.$matrix['date1_3']).'</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2" style="border-right:1mm solid #2284C6; border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="2" style="border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td colspan="2" style="border-right:1mm solid #2284C6; border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="2" style="border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td colspan="2" style="border-right:1mm solid #2284C6; border-bottom:1mm solid #2284C6">&nbsp;</td>
<td colspan="2" style="border-bottom:1mm solid #2284C6">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2" style="border-right:1mm solid #2284C6; border-left:1mm solid #2284C6">&nbsp;</td>
<td colspan="2" style="border-right:1mm solid #2284C6">&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td colspan="2" style="border-right:1mm solid #2284C6; border-left:1mm solid #2284C6">&nbsp;</td>
<td colspan="2" style="border-right:1mm solid #2284C6">&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td colspan="2" style="border-right:1mm solid #2284C6; border-left:1mm solid #2284C6">&nbsp;</td>
<td colspan="2" style="border-right:1mm solid #2284C6">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2" align="center"><img src="../image/rgicon'.($matrix['lvl2_1']=='0'?"0":"").'.png"></td>
<td colspan="2" align="center"><img src="../image/rgicon'.($matrix['lvl2_2']=='0'?"0":"").'.png"></td>
<td colspan="2" align="center"><img src="../image/rgicon'.($matrix['lvl2_3']=='0'?"0":"").'.png"></td>
<td colspan="2" align="center"><img src="../image/rgicon'.($matrix['lvl2_4']=='0'?"0":"").'.png"></td>
<td colspan="2" align="center"><img src="../image/rgicon'.($matrix['lvl2_5']=='0'?"0":"").'.png"></td>
<td colspan="2" align="center"><img src="../image/rgicon'.($matrix['lvl2_6']=='0'?"0":"").'.png"></td>
<td colspan="2" align="center"><img src="../image/rgicon'.($matrix['lvl2_7']=='0'?"0":"").'.png"></td>
<td colspan="2" align="center"><img src="../image/rgicon'.($matrix['lvl2_8']=='0'?"0":"").'.png"></td>
<td colspan="2" align="center"><img src="../image/rgicon'.($matrix['lvl2_9']=='0'?"0":"").'.png"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2" align="center">'.($matrix['lvl2_1']=='0'?__('Available'):$matrix['lvl2_1'].'<br>'.$matrix['date2_1']).'</td>
<td colspan="2" align="center">'.($matrix['lvl2_2']=='0'?__('Available'):$matrix['lvl2_2'].'<br>'.$matrix['date2_2']).'</td>
<td colspan="2" align="center">'.($matrix['lvl2_3']=='0'?__('Available'):$matrix['lvl2_3'].'<br>'.$matrix['date2_3']).'</td>
<td colspan="2" align="center">'.($matrix['lvl2_4']=='0'?__('Available'):$matrix['lvl2_4'].'<br>'.$matrix['date2_4']).'</td>
<td colspan="2" align="center">'.($matrix['lvl2_5']=='0'?__('Available'):$matrix['lvl2_5'].'<br>'.$matrix['date2_5']).'</td>
<td colspan="2" align="center">'.($matrix['lvl2_6']=='0'?__('Available'):$matrix['lvl2_6'].'<br>'.$matrix['date2_6']).'</td>
<td colspan="2" align="center">'.($matrix['lvl2_7']=='0'?__('Available'):$matrix['lvl2_7'].'<br>'.$matrix['date2_7']).'</td>
<td colspan="2" align="center">'.($matrix['lvl2_8']=='0'?__('Available'):$matrix['lvl2_8'].'<br>'.$matrix['date2_8']).'</td>
<td colspan="2" align="center">'.($matrix['lvl2_9']=='0'?__('Available'):$matrix['lvl2_9'].'<br>'.$matrix['date2_9']).'</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>';


$tab_content=$messaging;
$content="<h2>$page_title</h2>".str_replace("<%tab_content%>", $tab_content, $tab);
print format_member_page($content, $this_title, $content_title, $css.$jvscript);


?>
